<!--#include file="admin/Includes/constants.asp"-->
<!--#include file="admin/Includes/validate.asp"-->
<%
Dim objStream, DocType
Dim wpSize, wpName, wpPath, wpImageID
DocType=request("dt")
wpImageID = request("iid")
wpSize = request("is")
wpName = request("in")
If wpSize <> "" Then
	wpPath = server.MapPath("hinh-nen-thoi-trang") & "/"  & wpSize & "/" & wpName
Else
	wpPath = server.MapPath("hinh-anh-nguoi-mau") & "/" & wpName
End If

strSQL = "{CALL a_download ("& wpImageID &","& DocType &")}"	
Exec(strSQL)
CloseCon

'Const adTypeBinary = 1 'turn off before upload to server
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile wpPath
Response.AddHeader "Content-Disposition", "attachment;filename=" & wpName
Response.ContentType = "application/octet-stream"
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
	%>

